package unverified

import (
	"context"

	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/logic/user_profile"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/svc"
	"algo-sdk-go/project/matchmaking/matchMaking-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type AppendUnverifiedUserprofileLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewAppendUnverifiedUserprofileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AppendUnverifiedUserprofileLogic {
	return &AppendUnverifiedUserprofileLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *AppendUnverifiedUserprofileLogic) AppendUnverifiedUserprofile(req *types.AppendUserprofileRequest) (resp *types.SyncUserprofileResponse, err error) {
	userNum, err := l.svcCtx.UnverifiedUserProfileService.AppendUnverifiedUserProfile(l.ctx, user_profile.TransAppendUserprofileCommand(req))
	if err != nil {
		return nil, err
	}

	resp = &types.SyncUserprofileResponse{
		Data: types.SyncUserprofileData{
			UserNum: userNum,
		},
	}
	return
}
